//
//  IDMacroDefine.h
//  IngCard
//
//  Created by kf on 2017/5/17.
//  Copyright © 2017年 IngDan. All rights reserved.
//

#ifndef IDMacroDefine_h
#define IDMacroDefine_h

#pragma mark - NSObject

#ifndef weakObj
#if __has_feature(objc_arc)
#define Weak(object)  __weak __typeof__(object) weak##_##object = object;
#else
#define Weak(object)  __block __typeof__(object) block##_##object = object;
#endif
#endif

#ifndef strongObj
#if __has_feature(objc_arc)
#define Strong(object)  __typeof__(object) object = weak##_##object; if(!object) return;
#else
#define Strong(object)  __typeof__(object) object = block##_##object; if(!object) return;
#endif
#endif

#pragma mark - Log
#ifdef DEBUG
#define Log(...) printf("[%s] %s [第%d行]: %s\n", __TIME__ ,__PRETTY_FUNCTION__ ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String])
#else
#define Log(...)
#endif


#pragma mark - Thread

#define dispatch_async_main(block)\
if ([NSThread isMainThread]) {\
block();\
} else {\
dispatch_async(dispatch_get_main_queue(), block);\
}

#pragma mark - block
#define BlockGoGo(BlockName, ...) ({ !BlockName ? nil : BlockName(__VA_ARGS__); })



#define NSStringFormat(format,...) [NSString stringWithFormat:format,##__VA_ARGS__]

#define NSNotificationMake(name,obj) [[NSNotificationCenter defaultCenter] postNotificationName:name object:obj]

#define IOS9_LATER ([[UIDevice currentDevice] systemVersion].floatValue > 9.0 ? YES : NO )


#define UIImageViewSetUrl(imageView,url) [imageView yy_setImageWithURL:url options:(YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation)];

#define UIImageViewSetStr(imageView,url) [imageView yy_setImageWithURL:[NSURL URLWithString:url] options:(YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation)];

#endif /* IDMacroDefine_h */
